#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>

int main(int argc, char *argv[])
{
    printf("before fork--------\n");

    pid_t pid = fork();
    if (pid == -1)
    {
        perror("fork error");
        exit(1);
    }
    else if (pid == 0)
    {
        printf("------child is created, pid = %d, parent-pid = %d\n", getpid(), getppid());
    }
    else if (pid > 0)
    {
        printf("-----parent process: my child is %d, mypid = %d, my ppid = %d\n", pid, getpid(), getppid());
    }

    printf("===========end of file\n");


    return 0;
}